package com.woniu.order.controller;

import com.woniu.commons.anno.RequirePerms;
import com.woniu.commons.response.ResponseResult;
import com.woniu.commons.util.JWTUtil;
import com.woniu.order.service.OrderService;
import com.woniu.order.vo.OrderVo;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;

@RestController
@RequestMapping("/order")
public class OrderController {
    @Resource
    private OrderService orderService;

    @RequirePerms("order:test")
    @GetMapping("/test")
    public String test() {
        return "order test";
    }

    //下订单
    @PostMapping("/add")
    public ResponseResult<Boolean> add(@RequestBody OrderVo vo, @RequestHeader String authorization) {
        orderService.add(vo, JWTUtil.getUserId(authorization));


        return null;
    }
}
